<?php

declare(strict_types=1);

namespace App\Request\user;

use Hyperf\Validation\Request\FormRequest;

/**
 * 用户管理 请求参数验证
 */
class UserRequest extends FormRequest
{

    protected array $scenes = [
        // PC登录
        'login' => ['account', 'password'],
        'update'=>['id'],
        'delete'=>['id']
    ];

    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'account'=>'required|max:20',
            'password'=>'required|max:20',
        ];
    }

    public function messages(): array
    {
        return [
            'account.required'=>'请输入账号',
            'account.max'=>'账号长度不能超过20个字符',
            'password.required'=>'请输入密码',
            'password.max'=>'密码长度不能超过20个字符',
        ];
    }
}
